package me.ereach.streams;

import java.util.Comparator;
import java.util.List;

public class MainPeeking {
    public static void main(String[] args) {
        var movies = List.of(
                new Movie("a", 10),
                new Movie("b", 20),
                new Movie("c", 30)
        );

        long cnt = movies.stream()
                .count();
        System.out.println(cnt);

        boolean rst = movies.stream()
                .anyMatch(m -> m.getLikes() > 20);
        System.out.println(rst);

        rst = movies.stream()
                .allMatch(m -> m.getLikes() > 20);
        System.out.println(rst);

        rst = movies.stream()
                .noneMatch(m -> m.getLikes() > 20);
        System.out.println(rst);

        var result = movies.stream()
                .findFirst()
                .get();
        System.out.println(result.getTitle());

        result = movies.stream()
                .findAny()
                .get();
        System.out.println(result.getTitle());

        result = movies.stream()
                .max(Comparator.comparing(Movie::getLikes))
                .get();
        System.out.println(result.getTitle());
    }
}
